'use strict'

var React = require('react-native');
var BtnContainer = require('./button');

var {
	View,
	Text,
	StyleSheet
} = React;


/**
 * 增加此组件主要原因是RN升级到0.15.0后,官方的AlertIOS在ComponentDidMount
 * 中不能正常工作
 */
var AlertIOS = React.createClass({


	render() {
		return (
			<View style={styles.alertContainer}>
				<View style={styles.container}>
					<Text style={styles.title}>有新版本，请升级</Text>
					<BtnContainer onPress={this.props.onPress}>
						<Text style={styles.confirm}>确定</Text>
					</BtnContainer>
				</View>
			</View>
		)
	},
})


var styles = StyleSheet.create({
	alertContainer: {
		position: 'absolute',
		top: 0,
		left: 0,
		right: 0,
		bottom: 0,
		justifyContent: 'center',
		alignItems: 'center',
		backgroundColor: 'rgba(0,0,0,0.3)'
	},
	container: {
		flexWrap: 'wrap',
		paddingLeft: 60,
		paddingRight: 60,
		paddingTop: 20,
		borderRadius: 10,
		backgroundColor: '#fff',
		alignItems: 'center'
	},
	title: {
		fontSize: 16,
		color: '#000',
		fontWeight: 'bold',
		paddingBottom: 40,
	},
	confirm: {
		fontSize: 16,
		color: '#599FEE',
		fontWeight: 'bold',
		paddingBottom: 20,
	}
});


module.exports = AlertIOS;